# Maintainer: psykose <alice@ayaya.dev>
pkgname=lua-language-server
pkgver=3.4.2
pkgrel=0
pkgdesc="Language Server for Lua"
url="https://github.com/sumneko/lua-language-server"
arch="all !s390x !ppc64le" # ftbfs
license="MIT"
makedepends="bash samurai"
source="https://github.com/sumneko/lua-language-server/archive/refs/tags/$pkgver/lua-language-server-$pkgver.tar.gz
	lua-language-server-submodules-$pkgver.zip.noauto::https://github.com/sumneko/lua-language-server/releases/download/$pkgver/lua-language-server-$pkgver-submodules.zip
	wrapper
	"
options="!check" # no tests

prepare() {
	default_prepare

	unzip -o "$srcdir"/lua-language-server-submodules-$pkgver.zip.noauto \
		-d "$builddir"
}

build() {
	ninja -C 3rd/luamake -f compile/ninja/linux.ninja
	./3rd/luamake/luamake rebuild
}

package() {
	install -Dm755 "$srcdir"/wrapper "$pkgdir"/usr/bin/lua-language-server
	install -Dm755 bin/lua-language-server \
		-t "$pkgdir"/usr/lib/lua-language-server/bin
	install -Dm644 bin/main.lua \
		-t "$pkgdir"/usr/lib/lua-language-server/bin
	install -Dm644 debugger.lua main.lua \
		-t "$pkgdir"/usr/lib/lua-language-server
	cp -a locale meta script "$pkgdir"/usr/lib/lua-language-server
}

sha512sums="
3003d0e669d43a1a07385ac102c7466940efb59ead70828753e9af8fccc04ef7ac814aadaf84cf521b7b174e85b4d48937083451a68f3c4c14c29ad1925812b6  lua-language-server-3.4.2.tar.gz
416174501beb632b53942d1d9f2d914bdc492c76eef76f65b7db91cddfba03316391f8def0660b7c20d0b433c8353364d7e90ce61a07fd81b8320fdb2b68d016  lua-language-server-submodules-3.4.2.zip.noauto
9fa9621b61a365a576079731afe419245268b5223292989d2f98091a26b8866ba97a8c6c4cf8e5cbb2704089cb45167630557049430105a71ed4fd55311a543a  wrapper
"
